package cn.buk.tms.dto;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * @author yfdai
 */
public class EntBalanceDto {

    private int id;

    /**
     * 被授权方
     */
    private int enterpriseId;

    /**
     * 被授权方的名字
     */
    private String name;

    private String pinyin;

    private String customerCode;


    /**
     * 现金账户余额,单位比特币(可以提现的), 100比特币=1元人民币
     */
    private int cashBalance;

    /**
     * 比特币余额,单位比特币(不能提现)
     */
    private int bitcoinBalance;

    /**
     * 冻结资金
     *  买家申请退票时,将从卖家的现金账户中扣除退票的原付金额冻结到此处,从cashBalance中减去对应的金额
     */
    private int frozenBalance;

    /**
     * 信用额度
     * 在现金账户余额不足时,可以透支,但透支额度不能超过信用额度的 120%。
     */
    private int creditLimit;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date lastUpdate;

    /**
     * 信用余额
     * @return
     */
    public int getCreditBalance() {
        return this.creditLimit + this.cashBalance;
    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCashBalance() {
        return cashBalance;
    }

    public void setCashBalance(int cashBalance) {
        this.cashBalance = cashBalance;
    }

    public int getBitcoinBalance() {
        return bitcoinBalance;
    }

    public void setBitcoinBalance(int bitcoinBalance) {
        this.bitcoinBalance = bitcoinBalance;
    }

    public int getFrozenBalance() {
        return frozenBalance;
    }

    public void setFrozenBalance(int frozenBalance) {
        this.frozenBalance = frozenBalance;
    }

    public int getCreditLimit() {
        return creditLimit;
    }

    public void setCreditLimit(int creditLimit) {
        this.creditLimit = creditLimit;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public String getPinyin() {
        return pinyin == null ? "": pinyin.trim();
    }

    public String getCustomerCode() {
        return customerCode;
    }

    public void setCustomerCode(String customerCode) {
        this.customerCode = customerCode;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }
}
